<div id="step-holder">
    <div class="step-no">1</div>
    <div class="step-dark-left"><a href="">Chọn <?=$this->ten_loai ?></a></div>
    <div class="step-dark-right">&nbsp;</div>
    <div class="step-no-off">2</div>
    <div class="step-light-left">Cho mượn</div>
    <div class="step-light-right">&nbsp;</div>
    <div class="step-no-off">3</div>
    <div class="step-light-left">In</div>
    <div class="step-light-round">&nbsp;</div>
    <div class="clear"></div>
</div>
<div style="width:550px;padding-bottom:8px;">
<p id="title"><strong> <font color="#004FA0">Tên : </font></strong></p>
<p id="code"><strong> <font color="#004FA0">Mã : </font></strong></p>
</div>
<table cellspacing="0" cellpadding="0" border="0" width="550px" id="product-table" align="center">
    <tbody>
        <tr style="background-color:#6B6B6B;color:white;font-weight:bold;">
            <td>Hành động</td>
            <td>Quyển</td>
            <td>Người mượn lần trước</td>
            <td>Tình trạng/Ngày trả</td>
        </tr>
<?php   
        $stt = 0;
        $countInData = 0;
        for($ii = 0; $ii < $this->soluong;$ii++){
            $stt++;
            $isValid = 0;
            foreach($this->data as $item){
                if($stt == (int)$item['QUYEN_SO'])
                {
                    $isValid = 1;
                }
            }
            if($isValid == 1){            
                if($this->data[$countInData]['TRANGTHAI'] == 2){
            ?>
                <tr>
                    <td width="70px"><a href="javascript:choMuon(<?=$stt ?>,1,'');" style="color:#004FA0;font-weight:bold;">Cho mượn</a></td>
                    <td width="70px">Quyển số <?=$stt ?></td>
                    <td><?=$this->data[$countInData]['TEN_NGUOI_MUON'] ?></td>
                    <td style="color:#004FA0;font-weight:bold;">Sẵn có</td>
                </tr>
            <?php } else { ?>
       <tr>
            <td width="70px">Chờ trả</td>
            <td width="70px">Quyển số <?=$stt ?></td>
            <td><?=$this->data[$countInData]['TEN_NGUOI_MUON'] ?></td>
            <td><?=common::convertToCultureDate($this->data[$countInData]['NGAY_TRA']) ?></td>
        </tr>
        <?php
            }
            $countInData++;
        }else { ?>
        <tr>
            <td width="70px"><a href="javascript:choMuon(<?=$stt ?>,1,'');" style="color:#004FA0;font-weight:bold;">Cho mượn</a></td>
            <td width="70px">Quyển số <?=$stt ?></td>
            <td>... ... ... ... ... ... ...</td>
            <td style="color:#004FA0;font-weight:bold;">Sẵn có</td>
        </tr>
        <?php
            }
        }
        ?>
    </tbody>
</table>
<script>
    function choMuon(quyenSo,isNew,ngaytra){
        var JX1 = new Jx();
        JX1.setParameter('quyenso',quyenSo);
        JX1.setParameter('ngaytra',ngaytra);
        JX1.setParameter('isNew',isNew);
        JX1.setParameter('loai',<?=$this->loai?>);
        JX1.setParameter('id',<?=$this->id?>);
        JX1.loadInto('select-book');
        JX1.success('fillInfoMuon');
        JX1.request('/admin/muon/index','');
    }
    
</script>